/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pehulja.mmdo.coursework.gui.graph;

import java.util.Arrays;
import java.util.Random;

/**
 *
 * @author pehulja
 */
public class Point implements Cloneable{
    private double x, y;

    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }

    public double getX() {
        return x;
    }

    public void setX(double x) {
        this.x = x;
    }

    public double getY() {
        return y;
    }

    public void setY(double y) {
        this.y = y;
    }

    public Point() {
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        return new Point(x, y);
    }
     public static void main(String [] argv){
         boolean flag = true;
         int operations = 0;
         int [] a = new int[100];
         int n = a.length;
         Random random = new Random();
         for(int i = 0; i< n ; i++)
             a[i] = random.nextInt()%100;
         /*for (int i =0; i < n && flag == true; i++){
             flag = false;
             for(int j = 0; j < n-1; j++){
                 if(a[j]>a[j+1]){
                  int temp = a[j];
                  a[j] = a[j+1];
                  a[j+1] = temp;
                  flag = true;
                  operations++;
                 }
             }
         }*/
         int b=1;
         for (int i =0; i < n; i++){
             //flag = false;
             for(int j = b; j < n; j++){
                 if(a[i]>a[j]){
                  int temp = a[j];
                  a[i] = a[j];
                  a[j] = temp;
                 // flag = true;
                  operations++;
                 }
                 b++;
             }
         }
         System.out.println(Arrays.toString(a)+ "\n"+operations);
         ///////////////////////////////
         
         for(int i=0;i<n;i++){
             int t=a[i+1];
             if(t<a[i]){
                a[i]=t; 
             }
            
         }
         
         
         //////////////////////////////////////
         
         
         
     }
    
}
